package com.jinzecloud.fiction.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.jinzecloud.fiction.bean.TbRole;
import com.jinzecloud.fiction.service.TbRoleService;
import com.jinzecloud.fiction.utils.PageUtils;
import com.jinzecloud.fiction.utils.R;



/**
 * 角色表
 *
 * @author ??
 * @email 1971240051@qq.com
 * @date 2023-10-19 19:38:04
 */
@RestController
@RequestMapping("fiction/tbrole")
public class TbRoleController {
    @Autowired
    private TbRoleService tbRoleService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("fiction:tbrole:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tbRoleService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{roId}")
    //@RequiresPermissions("fiction:tbrole:info")
    public R info(@PathVariable("roId") Integer roId){
		TbRole tbRole = tbRoleService.getById(roId);

        return R.ok().put("tbRole", tbRole);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("fiction:tbrole:save")
    public R save(@RequestBody TbRole tbRole){
		tbRoleService.save(tbRole);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("fiction:tbrole:update")
    public R update(@RequestBody TbRole tbRole){
		tbRoleService.updateById(tbRole);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("fiction:tbrole:delete")
    public R delete(@RequestBody Integer[] roIds){
		tbRoleService.removeByIds(Arrays.asList(roIds));

        return R.ok();
    }

}
